<template>
	<view>
		<dsl-navbar title="提现" bgTopImg="#F5F6F8" isBack=""></dsl-navbar>
		<view class="text-center">
			<view style="color: #9AA2B5;">可提现</view>
			<view class="user_pay margin-tb-xl">￥{{userInfo.money}}</view>
		</view>
		<view class="plugins_bottom">
			<view class="padding rowsb solid-bottom margin-top"
				@click="$tools.push('/pages/user/modules/withdraw/withdrawBinding')">
				<view class="align-center">
					<view class="form_title">
						提现账户：
					</view>
					<view>
						{{accountData.account?accountData.account:'请绑定提现账户'}}
					</view>
				</view>
				<view class="cuIcon-right"></view>
			</view>
			<view class="padding rowsb solid-bottom margin-top">
				<view class="align-center">
					<view class="form_title">
						金额：
					</view>
					<view>
						<input type="number" value="" placeholder="请输入提现金额，不少于50元" style="width: 400rpx;"
							placeholder-style="color:#B7BED8" v-model="amount" />
					</view>
				</view>
			</view>
			<view class="padding rowsb solid-bottom margin-top">
				<view class="align-center">
					<view class="form_title">
						提现密码：
					</view>
					<view>
						<input type="text" value="" placeholder="请输入提现密码" style="width: 400rpx;"
							placeholder-style="color:#B7BED8" />
					</view>
				</view>
				<view class="text-sm" @click="$tools.push('withdrawForgetPassword')">忘记密码？</view>
			</view>
			<view class="text-xs text-center padding" style="color: #EAA019;">
				请确保提现账号正确，如提供错误账号导致损失，平台不复任何责任
			</view>
			<view class="position_submit">

				<view class="submit animation-scale-up" @click="submit">
					立即提现
				</view>
				<view class="text-center margin" @click="$tools.push('withdrawContent')">
					提现说明
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
	} from 'vuex'
	export default {
		data() {
			return {
				userInfo: uni.getStorageSync('userInfo'),
				amount: '', //提现金额
			}
		},
		//生命周期函数
		onReady() {},
		onLoad() {
			this.getAccount() //提现账户查询
		},
		onShow() {},
		methods: {

			/**
			 * @description vuex money模板
			 * getAccount 查询账户
			 * applyWithdrawal 申请提现
			 */
			...mapActions('money', ['getAccount', 'applyWithdrawal']),
			//提现
			submit() {
				let v = this
				if (v.accountData.account) {
					if (v.amount >= 50) {
						v.applyWithdrawal({
							amount: v.amount, //提现金额
							account: v.accountData.account, //账户
							type: 1, // 1-支付宝 2-微信
							realName: v.accountData.realName, //真实姓名
						})
					} else {
						v.$tools.showToast('提现金额不少于50')
					}
				} else {
					v.$tools.showToast('请先完成账户绑定')
				}
			}
		},
		computed: {
			/**
			 * @description vuex money模板
			 * accountData 提现账户查询
			 */
			...mapState('money', ['accountData']),

		},
		components: {},
	}
</script>

<style>
	page {
		background-color: #F5F6F8;
	}

	.user_pay {
		font-size: 60rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #EAA019;
		opacity: 1;
	}

	/* 功能 */
	.plugins_bottom {
		width: 750rpx;
		height: 1010rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 30rpx 30rpx 0px 0px;
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		color: #B7BED8;
	}

	.form_title {
		width: 140rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #333333;
		opacity: 1;
	}

	.position_submit {
		position: absolute;
		bottom: 100rpx;
		left: 0;
		right: 0;
	}

	.submit {
		width: 600rpx;
		height: 90rpx;
		background: linear-gradient(180deg, #EAA019 0%, #BA4949 100%);
		box-shadow: 0px 0px 20rpx rgba(153, 153, 153, 0.2);
		border-radius: 55rpx;
		color: white;
		text-align: center;
		line-height: 90rpx;
		margin: 0 auto;
	}
</style>
